-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add concurrency testing for storage operations #1132
base: mutations/mutations
Are you sure you want to change the base?
test: add concurrency testing for storage operations #1132
Conversation
...ware/amazon/cryptography/example/hierarchy/concurrent/ConcurrentConditionCheckWriteTest.java
Outdated
Show resolved
Hide resolved
...ware/amazon/cryptography/example/hierarchy/concurrent/ConcurrentConditionCheckWriteTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this doing here?
Is this temporary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is temporary. I wanted to add a barebones README for these tests
@josecorella and @texastony, I noticed you are updating the smithy model files. |
8032a45
to
4b2b629
Compare
a9c2675
to
b96c516
Compare
force pushed due to rebase from mutations/mutations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is Awesome!
But there are some things I think we need to fix up before calling this done.
Also, right now, I cannot figure out if the new library_concurrency_tests.yml
was run by GitHub CI here or not.
145 checks passed.
mutations/mutations
has 142 checks.
So... maybe the new checks ran?
But I cannot figure out which of the 145 checks they are,
I think because their name is Library Interoperability Tests
which conflicts with another GitHub workflow.
# This workflow performs interoperability tests across the supported runtimes of the MPL. | ||
name: Library Interoperability Tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking: We need to fix this up.
Or else the Job will run under the wrong name.
] | ||
# https://taskei.amazon.dev/tasks/CrypTool-5284 | ||
dotnet-version: ["6.0.x"] | ||
java-versions: [8, 11, 16, 17] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking/comment: For my money, I would only test on Java 8 and Java 17.
Maybe even only Java 8.
I do not think the subject of these tests changes behavior under different Java versions.
# https://taskei.amazon.dev/tasks/CrypTool-5284 | ||
dotnet-version: ["6.0.x"] | ||
java-versions: [8, 11, 16, 17] | ||
runs-on: ${{ matrix.os }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking/question: Does the subject of these tests change behavior across OS-es?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, copy-pasta
with: | ||
aws-region: us-west-2 | ||
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-MPL-Dafny-Role-us-west-2 | ||
role-session-name: InterOpTests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking: not InterOpTests but Concurrency tests, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup! just copy pasta-ying
} | ||
|
||
val testConcurrentExamples = task<Test>("testConcurrentExamples") { | ||
description = "Runs examples tests." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description = "Runs examples tests." | |
description = "Runs Concurrency tests." |
Assert.assertTrue( | ||
(cancellationReason.code().equals("TransactionConflict") || | ||
cancellationReason.code().equals("None") || | ||
cancellationReason.code().equals("ConditionalCheckFailed")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assert only fires if an Exception is thrown.
There is no assert on the non-catch path.
Also, there is no evidence if, in the 10 * 100 = 1000 invocations,
one of these asserts was met.
@Test( | ||
dependsOnMethods = { | ||
"testConcurrentActiveReadWhileVersionInFlight", | ||
"testConcurrentVersionWithStorage", | ||
} | ||
) | ||
public void testVersionReads() { | ||
Assert.assertFalse(versionKeyOutputMap.isEmpty()); | ||
for (String key : versionKeyOutputMap.keySet()) { | ||
System.out.println( | ||
"key: " + key + " value " + versionKeyOutputMap.get(key) | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method asserts that testConcurrentActiveReadWhileVersionInFlight
succeeded at least once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. That is what I want. This test proves that while a versioning is going on we can still read.
GetItemResponse res = DdbHelper.getKeyStoreDdbItem( | ||
branchKeyId, | ||
"branch:ACTIVE", | ||
Fixtures.TEST_KEYSTORE_NAME, | ||
DynamoDbClient.create() | ||
); | ||
DdbHelper.deleteKeyStoreDdbItem( | ||
branchKeyId, | ||
"branch:ACTIVE", | ||
Fixtures.TEST_KEYSTORE_NAME, | ||
DynamoDbClient.create(), | ||
true | ||
); | ||
DdbHelper.deleteKeyStoreDdbItem( | ||
branchKeyId, | ||
"beacon:ACTIVE", | ||
Fixtures.TEST_KEYSTORE_NAME, | ||
DynamoDbClient.create(), | ||
true | ||
); | ||
DdbHelper.deleteKeyStoreDdbItem( | ||
branchKeyId, | ||
res.item().get("version").s(), | ||
Fixtures.TEST_KEYSTORE_NAME, | ||
DynamoDbClient.create(), | ||
true | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previous class, use DeleteBranchKey.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. Do we need to do something to ensure that both tests run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testLogging { | ||
events("passed") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are running 1000 + 150 + more tests, you may not want to log every pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these concurrency tests are expensive and I don't want them to run every pr - if i have them run once a week, I don't see an issue in logging the passes.
Issue #, if available:
Description of changes:
Squash/merge commit message, if applicable:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.